import globals from "globals";
import pluginVue from "eslint-plugin-vue";

import path from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
import pluginJs from "@eslint/js";
import prettier from "eslint-plugin-prettier";
import eslintConfigPrettier from "eslint-config-prettier";

// mimic CommonJS variables -- not needed if using CommonJS
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({ baseDirectory: __dirname, recommendedConfig: pluginJs.configs.recommended });

export default [
	{
		ignores: ["dist/**", "node_modules/**"],
		plugins: {
			prettier,
		},
		rules: {
			"prettier/prettier": "error",
			"vue/script-setup-uses-vars": "error",
		},
		languageOptions: { globals: { ...globals.browser, ...globals.node } },
	},

	...compat.extends("standard"),
	...compat.extends("./.eslintrc-auto-import.json"),
	...pluginVue.configs["flat/essential"],
	eslintConfigPrettier,
];
